<template>
	<view>
		<view class="cu-list menu-avatar">
				<view class="cu-item">
					<view class="cu-avatar round lg" :style="'background-image:url('+user_info.avatarUrl+');'"></view>
					<view class="content">
						<view class="text-grey">{{user_info.nickname?user_info.nickname:'未设置昵称'}} </view>
						<view class="text-gray text-sm flex">
							<view class="text-cut">
								{{user_info.phone?user_info.phone:'未绑定手机号'}}
							</view> </view>
					</view>
					<view @click="bindPhone" class="action" style="width: 160upx;">
						 {{user_info.phone?'更换手机号':'绑定手机号'}}
					</view>
				</view>
				<view class="cu-list menu sm-border margin-top" >
					<navigator class="cu-item arrow" url="/pages/order/list">
						<view class="content">
							<text class="cuIcon-list text-blue"></text>
							<text class="text-grey">我的订单</text>
						</view>
					</navigator>
					
					<navigator class="cu-item arrow" url="/pages/user/comment">
						<view class="content">
							<text class="cuIcon-markfill text-blue"></text>
							<text class="text-grey">我发出的评价</text>
						</view>
					</navigator>
					
					<navigator class="cu-item arrow" url="/pages/user/topics?pid=94">
						<view class="content">
						<text class="cuIcon-friendfavor text-blue"></text>
							<text class="text-grey">商家入驻</text>
						</view>
					</navigator>
					
					<view  class="cu-item arrow" @click="contactUs" >
					<view class="content">
						<text class="cuIcon-service text-blue"></text>
						<text class="text-grey">联系我们</text>
					</view>
					<view class="action">
						<text class="text-grey text-sm">4008374994</text>
					</view>
				</view>
				
					<!-- <view class="cu-item arrow" >
						<view class="content">
							<image src="/static/ico12.png" class="png" mode="aspectFit"></image>
							<text class="text-grey">联系物业</text>
						</view>
					</view> -->
				</view>
				 
				
			</view>	
	</view>
</template>


<script>
	import beeApp from '../../beeApp.js'
	export default {
		data() {
			return {
				items: {},
                    user_info: {
                        tenement_type:[],
						community:{
							
						}
                    },
                    user_id: 0,
                    userStatistics: {},
                    mounted: 0,
                    out_room_id:0,
                    community_id:0,
			}
		},
		onLoad() {
         this.fetchData();
		},
		
		onPullDownRefresh() { 
			this.fetchData();
			uni.stopPullDownRefresh();
		},
		
		onShow:function(){
			var reload = beeApp.getPageData("pages/user/index","reload");
			if(reload==1){
				beeApp.setPageData("pages/user/index",{reload:0});
				this.fetchData();
			}
		},
		methods: {
				contactUs: function() {
					uni.makePhoneCall({
						phoneNumber: "4008374994" 
					});
                },
				bindPhone:function(){
					 uni.navigateTo({
					 	url:'/pages/user/bindphone'
					 })
				},
                fetchData: function fetchData() {
                    var _this = this;
                    this.getUserInfo();
                    // _this.user_info = beeApp.getUserInfo();
                },
               
                getUserInfo:function(){
                    var that = this;
                    beeApp.api("/api/user/info",{
                        fields:"user_id,store_id,phone,nickname,phone,avatarUrl,last_update_time"
                    },function(res){
                         if(res.code==200){
                             that.user_info = res.data;
                             that.out_room_id = res.data.out_room_id;
                         }
                        
                    });
                }
		}
	}
</script>

<style>
.cu-list.menu>.cu-item .content .png{ width: 40upx; height: 40upx;}
</style>
